from PyQt5.QtCore import QThread, \
                         pyqtSignal
from RcLogAnalyzer.scripts.rcg import rcg_to_db, rcg_to_txt


class ThreadRcgOutput(QThread):
    trigger = pyqtSignal(int)
    processing_file_name = ''
    data_save_path = ''
    save_format = 0     # 0.db  1.txt

    def run(self):
        if self.save_format == 0:
            rcg_to_db(self.processing_file_name, self.data_save_path)
        else:
            rcg_to_txt(self.processing_file_name, self.data_save_path)
        self.trigger.emit(0)
